/*
 * @Description: -
 * @Author: sanghx
 * @Date: 2019-10-24 14:17:20
 * @LastEditors: nardy.sanghx
 * @LastEditTime: 2019-11-19 14:01:59
 */
import Fly from 'flyio/dist/npm/wx'
const request = new Fly()
request.config.baseURL = 'http://127.0.0.1:8080'
request.interceptors.request.use((request) => {
  request.headers = {
    'content-Type': 'application/json',
    'token': wx.getStorageSync('token')
  }
  return request
})

request.interceptors.response.use(
  (response, promise) => {
    return promise.resolve(response.data)
  },
  (err, promise) => {
    return promise.reject(err)
  }
)
export default request
